/*
*  Copyright 2019-2020 Zheng Jie
*
*  Licensed under the Apache License, Version 2.0 (the "License");
*  you may not use this file except in compliance with the License.
*  You may obtain a copy of the License at
*
*  http://www.apache.org/licenses/LICENSE-2.0
*
*  Unless required by applicable law or agreed to in writing, software
*  distributed under the License is distributed on an "AS IS" BASIS,
*  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*  See the License for the specific language governing permissions and
*  limitations under the License.
*/
package me.zhengjie.modules.zhihu.question.domain;

import lombok.Data;
import cn.hutool.core.bean.BeanUtil;
import io.swagger.annotations.ApiModelProperty;
import cn.hutool.core.bean.copier.CopyOptions;
import lombok.experimental.Accessors;

import javax.persistence.*;
import javax.validation.constraints.*;
import java.sql.Timestamp;
import java.io.Serializable;

/**
* @website https://el-admin.vip
* @description /
* @author 王超
* @date 2022-01-05
**/
@Entity
@Data
@Table(name="zhihu_question")
@Accessors(chain = true)
public class ZhihuQuestion implements Serializable {

    @Id
    @Column(name = "ID")
    @ApiModelProperty(value = "id")
    private String id;

    @Column(name = "TITLE",nullable = false)
    @NotBlank
    @ApiModelProperty(value = "标题")
    private String title;

    @Column(name = "VISIT_COUNT",nullable = false)
    @NotBlank
    @ApiModelProperty(value = "浏览数")
    private String visitCount;

    @Column(name = "URL",nullable = false)
    @NotBlank
    @ApiModelProperty(value = "问题URL")
    private String url;

    @Column(name = "FOLLOWER_COUNT",nullable = false)
    @NotBlank
    @ApiModelProperty(value = "关注人数")
    private String followerCount;

    @Column(name = "ANSWER_COUNT",nullable = false)
    @NotBlank
    @ApiModelProperty(value = "回答总数")
    private String answerCount;

    @Column(name = "CREATE_TIME")
    @ApiModelProperty(value = "createTime")
    private Timestamp createTime;

    @Column(name = "UPDATE_TIME")
    @ApiModelProperty(value = "updateTime")
    private Timestamp updateTime;

    @Column(name = "IS_DELETED")
    @ApiModelProperty(value = "是否删除")
    private String isDeleted;

    @Column(name = "theme_keyword_id",nullable = false)
    @NotBlank
    @ApiModelProperty(value = "主题关键词ID")
    private String themeKeywordId;

    @Column(name = "theme_id",nullable = false)
    @NotBlank
    @ApiModelProperty(value = "主题ID")
    private String themeId;

    public void copy(ZhihuQuestion source){
        BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
    }
}
